package com.magnificent.atlantis.common.entity.messages;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import java.util.Date;

/**
 * User: Babanin
 * Date: 04.05.2009
 * Time: 22:56:21
 */
@MappedSuperclass()
public abstract class ServerMeetingMessage extends ServerMessage {
    protected Date date;
    protected int eventId;
    protected String title;
    protected String comment;

    protected ServerMeetingMessage() {
    }

    @Basic()
    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    @Basic()
    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    @Basic()
    @Column(name = "eventId")
    public int getEventId() {
        return eventId;
    }

    public void setEventId(int eventId) {
        this.eventId = eventId;
    }

    @Basic()
    @Column(name = "comment")
    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;

        ServerMeetingMessage that = (ServerMeetingMessage) o;

        if (eventId != that.eventId) return false;
        if (comment != null ? !comment.equals(that.comment) : that.comment != null) return false;

        return true;
    }

    public int hashCode() {
        int result = super.hashCode();
        result = 31 * result + eventId;
        result = 31 * result + (comment != null ? comment.hashCode() : 0);
        return result;
    }
}
